<!DOCTYPE">
<html lang="en">
<head>
  <meta http-equiv="Content-Type" content="text/html;charset=UTF-8" />
  <title>第二题不断移动的div</title>
</head>
<body>
  <div style="position: absolute;left:0px; top: 20px;width: 20px;height: 20px;background: red;"></div>
</body>
</html>
<script>

var x=0;
var T=setInterval(function(){
  var div=document.querySelector("div");
  div.style.left=x+"px";
  x++;
},25)

</script>